﻿@inject ContentService articleService
@inject AppLinkService appLinkService
@inject OndutyDataService ondutyDataService
@inject ContentCateService contentCateService
@inject ConfigParmService configParmService

@{
    ViewData["Title"] = await SystemConfig.GetByFieldNameAsync("SiteName");
    ViewData["Description"] = await SystemConfig.GetByFieldNameAsync("Description");
    ViewData["CmsIndexBanner"] = await configParmService.GetOneAsync("cms_index_banner");
    ViewData["CmsIndexBannerHeight"] = await configParmService.GetOneAsync("cms_index_banner_height");
    Layout = null;
	ViewBag.friBar = await appLinkService.GetOneAsync(new() { Cid = 2});
    ViewBag.secBar = await appLinkService.GetOneAsync(new() { Cid = 1});
}
<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="@ViewData["Description"]">
    <meta name="author" content="Cdeng">
    <title>@ViewData["Title"]</title>
    <link href="~/lib/layui/css/layui.css" rel="stylesheet">
    <link href="~/home/css/main.css" rel="stylesheet">
    <link href="~/home/css/index.css" rel="stylesheet">
</head>
<body>
    @if (ViewData["CmsIndexBanner"] != null && ViewData["CmsIndexBanner"].ToString() != "")
    {
        <style>
            body { width: 100%; min-height: 100%; background: url("@ViewData["CmsIndexBanner"]") top center no-repeat #fff; }
            .cxuu-index-margin-top { margin-top: @ViewData["CmsIndexBannerHeight"]; }
        </style>
    }
    <!--头部部分 开始-->
    <partial name="_Header" />
    <!--头部部分 结束-->
    <!--头条小头条 开始-->
    <div class="layui-container">
        <div class="layui-card">
            <div class="layui-card-body cxuu-index-firsttile">
                <div class="firsttile">
                    @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 1, CacheName = "calist-toutiao-11", CacheTime = 600, Att = 1, Orderby = "Id Desc" }))
                    {
                        <a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@item.Title</a>
                    }
                </div>
                <!--小头条-->
                <p class="lead">
                    @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 2, CacheName = "calist-toutiao-2", CacheTime = 600, Att = 2, Orderby = "Id Desc" }))
                    {
                        <a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link"> [ @StringUtility.Trim(item.Title, 28) ] </a>
                    }
                </p>
            </div>
        </div>
    </div>
    <!--头条小头条 结束-->
    <!--轮播部分 开始-->
    <div class="layui-container">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-xs12 layui-col-md5">
                <div class="layui-carousel cxuu-carousel" id="lunbo" lay-filter="lunbo">
                    <div carousel-item="">
                        @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 5, CacheName = "imgcarouselx", CacheTime = 600, Att = 3, ImgBl = true }))
                        {
                            <div>
                                <div class="image"><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link"><img src="@item.Img" width="548" height="345" /></a></div>
                                <div class="title"><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 26)</a></div>
                            </div>

                        }
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body cxuu-index-top-center">
                        <div class="sec">
                            @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 1, Att = 2, CacheName = "calist-sec", Orderby = "Id Desc" }))
                            {
                                <a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 16)</a>
                            }
                        </div>
                        <ul>
                            @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 10, CacheName = "calist-center-list2",Orderby="Id Desc" }))
                            {
                                <li>
                                    <span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span>
                                    <a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 18)</a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>

            <div class="layui-col-xs12 layui-col-md3">
				<div class="layui-col-xs12 layui-col-md12">
					<a href="/home/member?id=1" target="_blank"><div class="cxuu-ldinfo-link"></div></a>
				</div>
				<div class="layui-col-xs12 layui-col-md12">
					<div class="layui-card">
					<div class="layui-card-header cxuu-card-head"> <i class="layui-icon layui-icon-speaker"></i> <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="1">通知通报</a></div>
						<div class="layui-card-body cxuu-list-tztb">
							<ul>
                                @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 8, CacheName = "calist-tztb-1", Orderby = "Id Desc" }))
								{
									<li>
										<span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span>
										<a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 18)</a>
									</li>
								}
							</ul>
						</div>
					</div>
				</div>
				
				

            </div>
        </div>
    </div>
    <!--轮播部分 结束-->

        <div class="layui-container" style="margin-top:10px;margin-bottom:10px;height:50px;">
        <div class="layui-hide-xs layui-col-md12">
            @foreach (var item in await ondutyDataService.GetListAsync(new() { Cid = 1, PageSize = 5, ReferToTime = DateTime.Now.ToString("yyyy-MM-dd"), Type = (int)OndutyTypeEnum.Type.等于参考时间 }))
            {
                <div> @item.CatName   @item.OneLevel  @item.Phone</div>
            }
        </div>
    </div>


    <!--链接调用-->
    @if (ViewBag.friBar?.Status == true)
    {
        <div class="layui-container" style="margin-top:10px;margin-bottom:10px;height:150px;">
            <div class="layui-hide-xs layui-col-md12">
                <div> <a href="@ViewBag.friBar.Url" class="nav-link"><img src="@ViewBag.friBar.Img" width="1330" height="150" /></a></div>
            </div>
        </div>
    }

    <!--第一部分 开始-->
    <div class="layui-container">
        <div class="layui-row layui-col-space10">
            <div class="layui-hide-xs layui-col-md2">
                <div class="layui-card">
                    <div class="layui-card-body cxuu-icon-list">
                        <ul>
                            @foreach (var item in await appLinkService.GetListAsync(new() { Cid = 1, PageSize = 10,Status=true }))
                            {
                                <li class="layui-col-xs6 layui-col-md6">
                                    <a href="@item.Url" class="nav-link" target="_blank">
                                        <i class="layui-icon @item.Ico"></i>  <div class="cxuu-icon-name">@item.Name</div>
                                    </a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-md10">
                <div class="layui-row  layui-col-space10">
                    <div class="layui-col-xs12 layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header cxuu-card-head"><i class="layui-icon layui-icon-layouts"></i> <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="1">公安要闻</a></div>
                            <div class="layui-card-body  cxuu-list">
                                <ul>
                                    @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 11, CacheName = "cate-index-list-1", Orderby = "Id Desc" }))
                                    {
                                        <li><span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 26)</a></li>
                                    }
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs12 layui-col-md6">
                        <div class="layui-card">
                            <div class="layui-card-header cxuu-card-head"><i class="layui-icon layui-icon-carousel"></i> <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="1">支队动态</a></div>
                            <div class="layui-card-body  cxuu-list">
                                <ul>
                                    @foreach (var item in await articleService.QyList(new() { Cids = null, Limit = 11, CacheName = "cate-index-list-7",Orderby="Id Desc" }))
                                    {
                                        <li><span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 26)</a></li>
                                    }
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--第一部分 结束-->
	
    <!--链接调用-->
    @if (ViewBag.secBar?.Status == true)
    {
        <div class="layui-container" style="margin-top:10px;margin-bottom:10px;height:150px;">
            <div class="layui-hide-xs layui-col-md12">
                <div> <a href="@ViewBag.secBar.Url" class="nav-link"><img src="@ViewBag.secBar.Img" width="1330" height="150" /></a></div>
            </div>
        </div>
    }
	
    <!--第二部分 开始-->

    <div class="layui-container">
        <div class="layui-row layui-col-space10">
            @foreach (var cates in await contentCateService.CateListByIdAsync(new int[]{ 1,2,3,4,5,6 }))//await configParmService.GetOneAsync("cms_home_index_bottom6cat")
            {
                <div class="layui-col-xs12 layui-col-md4">
                    <div class="layui-card">
                        <div class="layui-card-header cxuu-card-head"> <i class="layui-icon @cates.Ico"></i> <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="@cates.Id">@cates.Name</a></div>
                        <div class="layui-card-body  cxuu-list">
                            <ul>
                                @foreach (var item in await articleService.QyList(new() { Cids = new int[] { cates.Id }, Limit = 10, CacheName = "cates_" + cates.Id, Orderby = "Id Desc" }))
                                {
                                    <li><span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 20)</a></li>
                                }
                            </ul>
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
    <!--第二部分 结束-->
    <!--活动专题链接 开始-->
    <div class="layui-container">
        <div class="layui-row">
		<div class="layui-col-xs12 layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header  cxuu-card-head">活动专题</div>
                <div class="layui-card-body cxuu-link-list-bottom">
                    <ul>
                        @foreach (var item in await appLinkService.GetListAsync(new() { PageSize = 6 ,Cid=2,Status=true}))
                        {
                            <li>
                                <a href="@item.Url" class="nav-link">
                                    @if (item.Img != null)
                                    {
                                        <img src="@item.Img">
                                    }
                                    else
                                    {
                                        <img src="/home/images/ad.jpg">
                                    }
                                </a>
                            </li>
                        }
                    </ul>
                </div>
            </div>
        </div>
        </div>
    </div>
    <!--活动专题链接 结束-->

    <partial name="_Footer" />

    <script src="~/lib/layui/layui.js"></script>
    <script>
        layui.use(['carousel'], function () {
            var carousel = layui.carousel;
            carousel.render({
                elem: '#lunbo'
                , arrow: 'always'
                , width: '100%'
                , height: '375px'
                , indicator: 'inside'
            });
        });
    </script>
</body>
</html>

